<template>
  <div class="login" >
    <div class="login-close" @mousedown.stop @click="closeLogin">关闭</div>
    <div class="login-title">
      <div class="login-title-icon"></div>
      深瞳优学
    </div>
    <div class="login-form" @mousedown.stop>
      <div class="login-form-sleection">
        <selectionBar
          :list="selectTypeOptions"
          v-model:selectType="selectType"
          @select="handleSelect"
        ></selectionBar>
      </div>
      <div v-if="selectType === '微信扫码'" class="login-form-qRCode">
        <img class="login-form-qRCode-img" src="" alt="" />
        <div class="login-form-qRCode-text">
          请使用微信扫描二维码
          <span class="login-form-qRCode-text-refresh">刷新</span>
        </div>
      </div>
      <div v-else-if="selectType === '账号登陆'" class="login-form-account">
        <formConent></formConent>
      </div>
      <div v-else-if="selectType === '手机号登陆'" class="login-form-phone">
         <formConent :mode="1"></formConent>
      </div>
    </div>
  </div>
</template>

<script lang="ts" setup>
const selectType = ref('账号登陆')
const selectTypeOptions = ['微信扫码', '账号登陆', '手机号登陆']
const selectionBar = defineAsyncComponent(() => import('@/components/selectionBar.vue'))
const formConent = defineAsyncComponent(() => import('./components/from.vue'))
const handleSelect = (idx: string) => {
  console.log('看俺', idx)
}
const closeLogin = () => {
  window.electron.ipcRenderer.invoke('loginPage-window-close')
  }
</script>

<style scoped lang="scss">
.login {
  width: 100%;
  height: 100vh;
  background-color: #eee;
  display: flex;
  flex-direction: column;
  padding: 20px 60px;
  box-sizing: border-box;
  position: relative;
}
.login-close{
  position: absolute;
  top: 20px;
  right: 20px;
  font-size: 24px;
  color: #333333;
  cursor: pointer;
}
.login-title {
  height: 55px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  font-family:
    PingFangSC,
    PingFang SC;
  font-weight: 600;
  font-size: 24px;
  color: #333333;
  letter-spacing: 2px;
  margin-bottom: 20px;
  .login-title-icon {
    width: 55px;
    height: 55px;
    border: 1px solid #000;
  }
}
.login-form {
  width: 100%;
  height: 80%;
  background: rgba(255, 255, 255, 0.9);
  border-radius: 27px;
  backdrop-filter: blur(17px);
  padding: 20px;
  box-sizing: border-box;
}
.login-form-sleection {
  display: flex;
  justify-content: center;
}
.login-form-qRCode {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  margin-top: 40px;
  .login-form-qRCode-img {
    width: 200px;
    height: 200px;
  }
  .login-form-qRCode-text {
    font-family:
      PingFangSC,
      PingFang SC;
    font-weight: 600;
    font-size: 14px;
    color: #a0aab9;
    letter-spacing: 2px;
    .login-form-qRCode-text-refresh {
      margin-left: 10px;
      color: #518df1;
      cursor: pointer;
    }
  }
}
.login-form-account{
 padding: 50px;
 box-sizing: border-box;
}
.login-form-phone{
  padding: 50px;
 box-sizing: border-box;

}
</style>
